package com.next

import grails.transaction.Transactional

@Transactional
class ActivityTeamService
{

    def initActivityTeam(Activity activity, User user)
    {
        def activityTeam = ActivityTeam.find("from ActivityTeam where activity.id = :activity and user.id = :user",
                                             [activity: activity.id, user: user.id])

        if (!activityTeam)
        {
            activityTeam = new ActivityTeam()
            activityTeam.activity = activity
            activityTeam.user = user
            activityTeam.save flush: true
        }
    }
}
